home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 June / PersonalComputerWorld-June2009-CoverdiscCD.iso / Software / Freeware / Adobe AIR 1.5.1 / AdobeAIRInstaller.exe / setup.swf / scripts / mx / controls / TextArea.as < prev    next >
Encoding:
Text File  |  2009-02-12  |  29.8 KB  |  996 lines

  1. package mx.controls
  2. {
  3.    import flash.accessibility.AccessibilityProperties;
  4.    import flash.display.DisplayObject;
  5.    import flash.events.Event;
  6.    import flash.events.FocusEvent;
  7.    import flash.events.IOErrorEvent;
  8.    import flash.events.MouseEvent;
  9.    import flash.events.TextEvent;
  10.    import flash.system.IME;
  11.    import flash.system.IMEConversionMode;
  12.    import flash.text.StyleSheet;
  13.    import flash.text.TextField;
  14.    import flash.text.TextFieldAutoSize;
  15.    import flash.text.TextFieldType;
  16.    import flash.text.TextLineMetrics;
  17.    import mx.controls.listClasses.BaseListData;
  18.    import mx.controls.listClasses.IDropInListItemRenderer;
  19.    import mx.controls.listClasses.IListItemRenderer;
  20.    import mx.core.EdgeMetrics;
  21.    import mx.core.FlexVersion;
  22.    import mx.core.IDataRenderer;
  23.    import mx.core.IFlexModuleFactory;
  24.    import mx.core.IFontContextComponent;
  25.    import mx.core.IIMESupport;
  26.    import mx.core.IInvalidating;
  27.    import mx.core.IUITextField;
  28.    import mx.core.ScrollControlBase;
  29.    import mx.core.ScrollPolicy;
  30.    import mx.core.UITextField;
  31.    import mx.core.mx_internal;
  32.    import mx.events.FlexEvent;
  33.    import mx.events.ScrollEvent;
  34.    import mx.events.ScrollEventDetail;
  35.    import mx.events.ScrollEventDirection;
  36.    import mx.managers.IFocusManager;
  37.    import mx.managers.IFocusManagerComponent;
  38.    
  39.    use namespace mx_internal;
  40.    
  41.    public class TextArea extends ScrollControlBase implements IDataRenderer, IDropInListItemRenderer, IFocusManagerComponent, IIMESupport, IListItemRenderer, IFontContextComponent
  42.    {
  43.       mx_internal static const VERSION:String = "3.0.0.0";
  44.       
  45.       private var _text:String = "";
  46.       
  47.       private var _selectable:Boolean = true;
  48.       
  49.       private var _textWidth:Number;
  50.       
  51.       private var _restrict:String = null;
  52.       
  53.       private var htmlTextChanged:Boolean = false;
  54.       
  55.       private var _maxChars:int = 0;
  56.       
  57.       private var enabledChanged:Boolean = false;
  58.       
  59.       private var _condenseWhite:Boolean = false;
  60.       
  61.       private var accessibilityPropertiesChanged:Boolean = false;
  62.       
  63.       private var _hScrollPosition:Number;
  64.       
  65.       private var _textHeight:Number;
  66.       
  67.       private var displayAsPasswordChanged:Boolean = false;
  68.       
  69.       private var prevMode:String = null;
  70.       
  71.       private var selectableChanged:Boolean = false;
  72.       
  73.       private var restrictChanged:Boolean = false;
  74.       
  75.       private var selectionChanged:Boolean = false;
  76.       
  77.       private var maxCharsChanged:Boolean = false;
  78.       
  79.       private var _tabIndex:int = -1;
  80.       
  81.       private var errorCaught:Boolean = false;
  82.       
  83.       private var _selectionBeginIndex:int = 0;
  84.       
  85.       private var wordWrapChanged:Boolean = false;
  86.       
  87.       private var _data:Object;
  88.       
  89.       private var explicitHTMLText:String = null;
  90.       
  91.       private var styleSheetChanged:Boolean = false;
  92.       
  93.       private var tabIndexChanged:Boolean = false;
  94.       
  95.       private var editableChanged:Boolean = false;
  96.       
  97.       private var _editable:Boolean = true;
  98.       
  99.       private var allowScrollEvent:Boolean = true;
  100.       
  101.       private var _imeMode:String = null;
  102.       
  103.       private var condenseWhiteChanged:Boolean = false;
  104.       
  105.       protected var textField:IUITextField;
  106.       
  107.       private var _listData:BaseListData;
  108.       
  109.       private var _displayAsPassword:Boolean = false;
  110.       
  111.       private var _wordWrap:Boolean = true;
  112.       
  113.       private var _styleSheet:StyleSheet;
  114.       
  115.       private var textChanged:Boolean = false;
  116.       
  117.       private var _accessibilityProperties:AccessibilityProperties;
  118.       
  119.       private var _selectionEndIndex:int = 0;
  120.       
  121.       private var _htmlText:String = "";
  122.       
  123.       private var _vScrollPosition:Number;
  124.       
  125.       private var textSet:Boolean;
  126.       
  127.       public function TextArea()
  128.       {
  129.          super();
  130.          tabChildren = true;
  131.          mx_internal::_horizontalScrollPolicy = ScrollPolicy.AUTO;
  132.          mx_internal::_verticalScrollPolicy = ScrollPolicy.AUTO;
  133.       }
  134.       
  135.       public function get imeMode() : String
  136.       {
  137.          return _imeMode;
  138.       }
  139.       
  140.       public function set imeMode(param1:String) : void
  141.       {
  142.          _imeMode = param1;
  143.       }
  144.       
  145.       override protected function focusOutHandler(param1:FocusEvent) : void
  146.       {
  147.          var _loc2_:IFocusManager = focusManager;
  148.          if(_loc2_)
  149.          {
  150.             _loc2_.defaultButtonEnabled = true;
  151.          }
  152.          super.focusOutHandler(param1);
  153.          if(_imeMode != null && _editable)
  154.          {
  155.             if(IME.conversionMode != IMEConversionMode.UNKNOWN && prevMode != IMEConversionMode.UNKNOWN)
  156.             {
  157.                IME.conversionMode = prevMode;
  158.             }
  159.             IME.enabled = false;
  160.          }
  161.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  162.       }
  163.       
  164.       mx_internal function getTextField() : IUITextField
  165.       {
  166.          return textField;
  167.       }
  168.       
  169.       private function textField_textInputHandler(param1:TextEvent) : void
  170.       {
  171.          param1.stopImmediatePropagation();
  172.          var _loc2_:TextEvent = new TextEvent(TextEvent.TEXT_INPUT,false,true);
  173.          _loc2_.text = param1.text;
  174.          dispatchEvent(_loc2_);
  175.          if(_loc2_.isDefaultPrevented())
  176.          {
  177.             param1.preventDefault();
  178.          }
  179.       }
  180.       
  181.       override public function get accessibilityProperties() : AccessibilityProperties
  182.       {
  183.          return _accessibilityProperties;
  184.       }
  185.       
  186.       override protected function createChildren() : void
  187.       {
  188.          super.createChildren();
  189.          mx_internal::createTextField(-1);
  190.       }
  191.       
  192.       private function adjustScrollBars() : void
  193.       {
  194.          var _loc1_:Number = textField.bottomScrollV - textField.scrollV + 1;
  195.          var _loc2_:Number = textField.numLines;
  196.          setScrollBarProperties(textField.width + textField.maxScrollH,textField.width,textField.numLines,_loc1_);
  197.       }
  198.       
  199.       private function textFieldChanged(param1:Boolean, param2:Boolean) : void
  200.       {
  201.          var _loc3_:* = false;
  202.          var _loc4_:* = false;
  203.          if(!param1)
  204.          {
  205.             _loc3_ = _text != textField.text;
  206.             _text = textField.text;
  207.          }
  208.          _loc4_ = _htmlText != textField.htmlText;
  209.          _htmlText = textField.htmlText;
  210.          if(_loc3_)
  211.          {
  212.             dispatchEvent(new Event("textChanged"));
  213.             if(param2)
  214.             {
  215.                dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  216.             }
  217.          }
  218.          if(_loc4_)
  219.          {
  220.             dispatchEvent(new Event("htmlTextChanged"));
  221.          }
  222.          _textWidth = textField.textWidth;
  223.          _textHeight = textField.textHeight;
  224.       }
  225.       
  226.       private function textField_ioErrorHandler(param1:IOErrorEvent) : void
  227.       {
  228.       }
  229.       
  230.       [NonCommittingChangeEvent("change")]
  231.       [Bindable("textChanged")]
  232.       public function get text() : String
  233.       {
  234.          return _text;
  235.       }
  236.       
  237.       public function get styleSheet() : StyleSheet
  238.       {
  239.          return _styleSheet;
  240.       }
  241.       
  242.       mx_internal function createTextField(param1:int) : void
  243.       {
  244.          if(!textField)
  245.          {
  246.             textField = IUITextField(createInFontContext(UITextField));
  247.             textField.autoSize = TextFieldAutoSize.NONE;
  248.             textField.enabled = enabled;
  249.             textField.ignorePadding = true;
  250.             textField.multiline = true;
  251.             textField.selectable = true;
  252.             textField.styleName = this;
  253.             textField.tabEnabled = true;
  254.             textField.type = TextFieldType.INPUT;
  255.             textField.useRichTextClipboard = true;
  256.             textField.wordWrap = true;
  257.             textField.addEventListener(Event.CHANGE,textField_changeHandler);
  258.             textField.addEventListener(Event.SCROLL,textField_scrollHandler);
  259.             textField.addEventListener(IOErrorEvent.IO_ERROR,textField_ioErrorHandler);
  260.             textField.addEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  261.             textField.addEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  262.             textField.addEventListener("textFormatChange",textField_textFormatChangeHandler);
  263.             textField.addEventListener("textInsert",textField_textModifiedHandler);
  264.             textField.addEventListener("textReplace",textField_textModifiedHandler);
  265.             if(param1 == -1)
  266.             {
  267.                addChild(DisplayObject(textField));
  268.             }
  269.             else
  270.             {
  271.                addChildAt(DisplayObject(textField),param1);
  272.             }
  273.          }
  274.       }
  275.       
  276.       override public function get tabIndex() : int
  277.       {
  278.          return _tabIndex;
  279.       }
  280.       
  281.       override public function set accessibilityProperties(param1:AccessibilityProperties) : void
  282.       {
  283.          if(param1 == _accessibilityProperties)
  284.          {
  285.             return;
  286.          }
  287.          _accessibilityProperties = param1;
  288.          accessibilityPropertiesChanged = true;
  289.          invalidateProperties();
  290.       }
  291.       
  292.       public function setSelection(param1:int, param2:int) : void
  293.       {
  294.          _selectionBeginIndex = param1;
  295.          _selectionEndIndex = param2;
  296.          selectionChanged = true;
  297.          invalidateProperties();
  298.       }
  299.       
  300.       [Bindable("condenseWhiteChanged")]
  301.       public function get condenseWhite() : Boolean
  302.       {
  303.          return _condenseWhite;
  304.       }
  305.       
  306.       override protected function isOurFocus(param1:DisplayObject) : Boolean
  307.       {
  308.          return param1 == textField || super.isOurFocus(param1);
  309.       }
  310.       
  311.       [Bindable("displayAsPasswordChanged")]
  312.       public function get displayAsPassword() : Boolean
  313.       {
  314.          return _displayAsPassword;
  315.       }
  316.       
  317.       public function get selectionBeginIndex() : int
  318.       {
  319.          return !!textField ? textField.selectionBeginIndex : _selectionBeginIndex;
  320.       }
  321.       
  322.       public function get selectable() : Boolean
  323.       {
  324.          return _selectable;
  325.       }
  326.       
  327.       [Bindable("viewChanged")]
  328.       [Bindable("scroll")]
  329.       override public function set verticalScrollPosition(param1:Number) : void
  330.       {
  331.          super.verticalScrollPosition = param1;
  332.          _vScrollPosition = param1;
  333.          if(textField)
  334.          {
  335.             textField.scrollV = param1 + 1;
  336.             textField.background = false;
  337.          }
  338.          else
  339.          {
  340.             invalidateProperties();
  341.          }
  342.       }
  343.       
  344.       public function set text(param1:String) : void
  345.       {
  346.          textSet = true;
  347.          if(!param1)
  348.          {
  349.             param1 = "";
  350.          }
  351.          if(!isHTML && param1 == _text)
  352.          {
  353.             return;
  354.          }
  355.          _text = param1;
  356.          textChanged = true;
  357.          _htmlText = null;
  358.          explicitHTMLText = null;
  359.          invalidateProperties();
  360.          invalidateSize();
  361.          invalidateDisplayList();
  362.          dispatchEvent(new Event("textChanged"));
  363.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  364.       }
  365.       
  366.       public function set data(param1:Object) : void
  367.       {
  368.          var _loc2_:* = undefined;
  369.          _data = param1;
  370.          if(_listData)
  371.          {
  372.             _loc2_ = _listData.label;
  373.          }
  374.          else if(_data != null)
  375.          {
  376.             if(_data is String)
  377.             {
  378.                _loc2_ = String(_data);
  379.             }
  380.             else
  381.             {
  382.                _loc2_ = _data.toString();
  383.             }
  384.          }
  385.          if(_loc2_ !== undefined && !textSet)
  386.          {
  387.             text = _loc2_;
  388.             textSet = false;
  389.          }
  390.          dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
  391.       }
  392.       
  393.       public function set styleSheet(param1:StyleSheet) : void
  394.       {
  395.          _styleSheet = param1;
  396.          styleSheetChanged = true;
  397.          htmlTextChanged = true;
  398.          invalidateProperties();
  399.       }
  400.       
  401.       override protected function measure() : void
  402.       {
  403.          super.measure();
  404.          measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
  405.          measuredWidth = DEFAULT_MEASURED_WIDTH;
  406.          measuredMinHeight = measuredHeight = 2 * DEFAULT_MEASURED_MIN_HEIGHT;
  407.       }
  408.       
  409.       public function get fontContext() : IFlexModuleFactory
  410.       {
  411.          return moduleFactory;
  412.       }
  413.       
  414.       public function get selectionEndIndex() : int
  415.       {
  416.          return !!textField ? textField.selectionEndIndex : _selectionEndIndex;
  417.       }
  418.       
  419.       [Bindable("editableChanged")]
  420.       public function get editable() : Boolean
  421.       {
  422.          return _editable;
  423.       }
  424.       
  425.       override protected function focusInHandler(param1:FocusEvent) : void
  426.       {
  427.          var fm:IFocusManager;
  428.          var message:String = null;
  429.          var event:FocusEvent = param1;
  430.          if(event.target == this)
  431.          {
  432.             systemManager.stage.focus = TextField(textField);
  433.          }
  434.          fm = focusManager;
  435.          if(editable && Boolean(fm))
  436.          {
  437.             fm.showFocusIndicator = true;
  438.          }
  439.          if(fm)
  440.          {
  441.             fm.defaultButtonEnabled = false;
  442.          }
  443.          super.focusInHandler(event);
  444.          if(_imeMode != null && _editable)
  445.          {
  446.             IME.enabled = true;
  447.             prevMode = IME.conversionMode;
  448.             try
  449.             {
  450.                if(!errorCaught && IME.conversionMode != IMEConversionMode.UNKNOWN)
  451.                {
  452.                   IME.conversionMode = _imeMode;
  453.                }
  454.                errorCaught = false;
  455.             }
  456.             catch(e:Error)
  457.             {
  458.                errorCaught = true;
  459.                message = resourceManager.getString("controls","unsupportedMode",[_imeMode]);
  460.                throw new Error(message);
  461.             }
  462.          }
  463.       }
  464.       
  465.       [Bindable("dataChange")]
  466.       public function get listData() : BaseListData
  467.       {
  468.          return _listData;
  469.       }
  470.       
  471.       [Bindable("wordWrapChanged")]
  472.       public function get wordWrap() : Boolean
  473.       {
  474.          return _wordWrap;
  475.       }
  476.       
  477.       override public function set tabIndex(param1:int) : void
  478.       {
  479.          if(param1 == _tabIndex)
  480.          {
  481.             return;
  482.          }
  483.          _tabIndex = param1;
  484.          tabIndexChanged = true;
  485.          invalidateProperties();
  486.       }
  487.       
  488.       [NonCommittingChangeEvent("change")]
  489.       [Bindable("htmlTextChanged")]
  490.       public function get htmlText() : String
  491.       {
  492.          return _htmlText;
  493.       }
  494.       
  495.       override public function set enabled(param1:Boolean) : void
  496.       {
  497.          if(param1 == enabled)
  498.          {
  499.             return;
  500.          }
  501.          super.enabled = param1;
  502.          enabledChanged = true;
  503.          if(verticalScrollBar)
  504.          {
  505.             verticalScrollBar.enabled = param1;
  506.          }
  507.          if(horizontalScrollBar)
  508.          {
  509.             horizontalScrollBar.enabled = param1;
  510.          }
  511.          invalidateProperties();
  512.          if(Boolean(border) && border is IInvalidating)
  513.          {
  514.             IInvalidating(border).invalidateDisplayList();
  515.          }
  516.       }
  517.       
  518.       private function textField_textFieldStyleChangeHandler(param1:Event) : void
  519.       {
  520.          textFieldChanged(true,false);
  521.       }
  522.       
  523.       public function set restrict(param1:String) : void
  524.       {
  525.          if(param1 == _restrict)
  526.          {
  527.             return;
  528.          }
  529.          _restrict = param1;
  530.          restrictChanged = true;
  531.          invalidateProperties();
  532.          dispatchEvent(new Event("restrictChanged"));
  533.       }
  534.       
  535.       override public function get baselinePosition() : Number
  536.       {
  537.          var _loc1_:String = null;
  538.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  539.          {
  540.             _loc1_ = text;
  541.             if(!_loc1_ || _loc1_ == "")
  542.             {
  543.                _loc1_ = " ";
  544.             }
  545.             return viewMetrics.top + measureText(_loc1_).ascent;
  546.          }
  547.          if(!mx_internal::validateBaselinePosition())
  548.          {
  549.             return NaN;
  550.          }
  551.          return textField.y + textField.baselinePosition;
  552.       }
  553.       
  554.       private function textField_changeHandler(param1:Event) : void
  555.       {
  556.          textFieldChanged(false,false);
  557.          adjustScrollBars();
  558.          textChanged = false;
  559.          htmlTextChanged = false;
  560.          param1.stopImmediatePropagation();
  561.          dispatchEvent(new Event(Event.CHANGE));
  562.       }
  563.       
  564.       public function set condenseWhite(param1:Boolean) : void
  565.       {
  566.          if(param1 == _condenseWhite)
  567.          {
  568.             return;
  569.          }
  570.          _condenseWhite = param1;
  571.          condenseWhiteChanged = true;
  572.          if(isHTML)
  573.          {
  574.             htmlTextChanged = true;
  575.          }
  576.          invalidateProperties();
  577.          invalidateSize();
  578.          invalidateDisplayList();
  579.          dispatchEvent(new Event("condenseWhiteChanged"));
  580.       }
  581.       
  582.       public function get textWidth() : Number
  583.       {
  584.          return _textWidth;
  585.       }
  586.       
  587.       public function set displayAsPassword(param1:Boolean) : void
  588.       {
  589.          if(param1 == _displayAsPassword)
  590.          {
  591.             return;
  592.          }
  593.          _displayAsPassword = param1;
  594.          displayAsPasswordChanged = true;
  595.          invalidateProperties();
  596.          invalidateSize();
  597.          invalidateDisplayList();
  598.          dispatchEvent(new Event("displayAsPasswordChanged"));
  599.       }
  600.       
  601.       override public function get horizontalScrollPolicy() : String
  602.       {
  603.          return height <= 40 ? ScrollPolicy.OFF : mx_internal::_horizontalScrollPolicy;
  604.       }
  605.       
  606.       [Bindable("dataChange")]
  607.       public function get data() : Object
  608.       {
  609.          return _data;
  610.       }
  611.       
  612.       override public function get maxVerticalScrollPosition() : Number
  613.       {
  614.          return !!textField ? textField.maxScrollV - 1 : 0;
  615.       }
  616.       
  617.       public function set maxChars(param1:int) : void
  618.       {
  619.          if(param1 == _maxChars)
  620.          {
  621.             return;
  622.          }
  623.          _maxChars = param1;
  624.          maxCharsChanged = true;
  625.          invalidateProperties();
  626.          dispatchEvent(new Event("maxCharsChanged"));
  627.       }
  628.       
  629.       public function set selectable(param1:Boolean) : void
  630.       {
  631.          if(param1 == selectable)
  632.          {
  633.             return;
  634.          }
  635.          _selectable = param1;
  636.          selectableChanged = true;
  637.          invalidateProperties();
  638.       }
  639.       
  640.       [Bindable("viewChanged")]
  641.       [Bindable("scroll")]
  642.       override public function set horizontalScrollPosition(param1:Number) : void
  643.       {
  644.          super.horizontalScrollPosition = param1;
  645.          _hScrollPosition = param1;
  646.          if(textField)
  647.          {
  648.             textField.scrollH = param1;
  649.             textField.background = false;
  650.          }
  651.          else
  652.          {
  653.             invalidateProperties();
  654.          }
  655.       }
  656.       
  657.       override public function setFocus() : void
  658.       {
  659.          var _loc1_:int = verticalScrollPosition;
  660.          allowScrollEvent = false;
  661.          textField.setFocus();
  662.          verticalScrollPosition = _loc1_;
  663.          allowScrollEvent = true;
  664.       }
  665.       
  666.       public function set selectionBeginIndex(param1:int) : void
  667.       {
  668.          _selectionBeginIndex = param1;
  669.          selectionChanged = true;
  670.          invalidateProperties();
  671.       }
  672.       
  673.       [Bindable("restrictChanged")]
  674.       public function get restrict() : String
  675.       {
  676.          return _restrict;
  677.       }
  678.       
  679.       override protected function scrollHandler(param1:Event) : void
  680.       {
  681.          if(param1 is ScrollEvent)
  682.          {
  683.             if(!liveScrolling && ScrollEvent(param1).detail == ScrollEventDetail.THUMB_TRACK)
  684.             {
  685.                return;
  686.             }
  687.             super.scrollHandler(param1);
  688.             textField.scrollH = horizontalScrollPosition;
  689.             textField.scrollV = verticalScrollPosition + 1;
  690.             _vScrollPosition = textField.scrollV - 1;
  691.             _hScrollPosition = textField.scrollH;
  692.          }
  693.       }
  694.       
  695.       public function set fontContext(param1:IFlexModuleFactory) : void
  696.       {
  697.          this.moduleFactory = param1;
  698.       }
  699.       
  700.       mx_internal function removeTextField() : void
  701.       {
  702.          if(textField)
  703.          {
  704.             textField.removeEventListener(Event.CHANGE,textField_changeHandler);
  705.             textField.removeEventListener(Event.SCROLL,textField_scrollHandler);
  706.             textField.removeEventListener(IOErrorEvent.IO_ERROR,textField_ioErrorHandler);
  707.             textField.removeEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  708.             textField.removeEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  709.             textField.removeEventListener("textFormatChange",textField_textFormatChangeHandler);
  710.             textField.removeEventListener("textInsert",textField_textModifiedHandler);
  711.             textField.removeEventListener("textReplace",textField_textModifiedHandler);
  712.             removeChild(DisplayObject(textField));
  713.             textField = null;
  714.          }
  715.       }
  716.       
  717.       public function set selectionEndIndex(param1:int) : void
  718.       {
  719.          _selectionEndIndex = param1;
  720.          selectionChanged = true;
  721.          invalidateProperties();
  722.       }
  723.       
  724.       public function get textHeight() : Number
  725.       {
  726.          return _textHeight;
  727.       }
  728.       
  729.       public function set editable(param1:Boolean) : void
  730.       {
  731.          if(param1 == _editable)
  732.          {
  733.             return;
  734.          }
  735.          _editable = param1;
  736.          editableChanged = true;
  737.          invalidateProperties();
  738.          dispatchEvent(new Event("editableChanged"));
  739.       }
  740.       
  741.       override protected function commitProperties() : void
  742.       {
  743.          super.commitProperties();
  744.          if(hasFontContextChanged() && textField != null)
  745.          {
  746.             mx_internal::removeTextField();
  747.             mx_internal::createTextField(-1);
  748.             accessibilityPropertiesChanged = true;
  749.             condenseWhiteChanged = true;
  750.             displayAsPasswordChanged = true;
  751.             editableChanged = true;
  752.             enabledChanged = true;
  753.             maxCharsChanged = true;
  754.             restrictChanged = true;
  755.             selectableChanged = true;
  756.             tabIndexChanged = true;
  757.             wordWrapChanged = true;
  758.             textChanged = true;
  759.             selectionChanged = true;
  760.          }
  761.          if(accessibilityPropertiesChanged)
  762.          {
  763.             textField.accessibilityProperties = _accessibilityProperties;
  764.             accessibilityPropertiesChanged = false;
  765.          }
  766.          if(condenseWhiteChanged)
  767.          {
  768.             textField.condenseWhite = _condenseWhite;
  769.             condenseWhiteChanged = false;
  770.          }
  771.          if(displayAsPasswordChanged)
  772.          {
  773.             textField.displayAsPassword = _displayAsPassword;
  774.             displayAsPasswordChanged = false;
  775.          }
  776.          if(editableChanged)
  777.          {
  778.             textField.type = _editable && enabled ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
  779.             editableChanged = false;
  780.          }
  781.          if(enabledChanged)
  782.          {
  783.             textField.enabled = enabled;
  784.             enabledChanged = false;
  785.          }
  786.          if(maxCharsChanged)
  787.          {
  788.             textField.maxChars = _maxChars;
  789.             maxCharsChanged = false;
  790.          }
  791.          if(restrictChanged)
  792.          {
  793.             textField.restrict = _restrict;
  794.             restrictChanged = false;
  795.          }
  796.          if(selectableChanged)
  797.          {
  798.             textField.selectable = _selectable;
  799.             selectableChanged = false;
  800.          }
  801.          if(styleSheetChanged)
  802.          {
  803.             textField.styleSheet = _styleSheet;
  804.             styleSheetChanged = false;
  805.          }
  806.          if(tabIndexChanged)
  807.          {
  808.             textField.tabIndex = _tabIndex;
  809.             tabIndexChanged = false;
  810.          }
  811.          if(wordWrapChanged)
  812.          {
  813.             textField.wordWrap = _wordWrap;
  814.             wordWrapChanged = false;
  815.          }
  816.          if(textChanged || htmlTextChanged)
  817.          {
  818.             if(isHTML)
  819.             {
  820.                textField.htmlText = explicitHTMLText;
  821.             }
  822.             else
  823.             {
  824.                textField.text = _text;
  825.             }
  826.             textFieldChanged(false,true);
  827.             textChanged = false;
  828.             htmlTextChanged = false;
  829.          }
  830.          if(selectionChanged)
  831.          {
  832.             textField.setSelection(_selectionBeginIndex,_selectionEndIndex);
  833.             selectionChanged = false;
  834.          }
  835.          if(!isNaN(_hScrollPosition))
  836.          {
  837.             horizontalScrollPosition = _hScrollPosition;
  838.          }
  839.          if(!isNaN(_vScrollPosition))
  840.          {
  841.             verticalScrollPosition = _vScrollPosition;
  842.          }
  843.       }
  844.       
  845.       private function get isHTML() : Boolean
  846.       {
  847.          return explicitHTMLText != null;
  848.       }
  849.       
  850.       public function set listData(param1:BaseListData) : void
  851.       {
  852.          _listData = param1;
  853.       }
  854.       
  855.       [Bindable("maxCharsChanged")]
  856.       public function get maxChars() : int
  857.       {
  858.          return _maxChars;
  859.       }
  860.       
  861.       override public function get maxHorizontalScrollPosition() : Number
  862.       {
  863.          return !!textField ? textField.maxScrollH : 0;
  864.       }
  865.       
  866.       override protected function mouseWheelHandler(param1:MouseEvent) : void
  867.       {
  868.          param1.stopPropagation();
  869.       }
  870.       
  871.       private function textField_scrollHandler(param1:Event) : void
  872.       {
  873.          var _loc2_:int = 0;
  874.          var _loc3_:int = 0;
  875.          var _loc4_:ScrollEvent = null;
  876.          if(initialized && allowScrollEvent)
  877.          {
  878.             _loc2_ = textField.scrollH - horizontalScrollPosition;
  879.             _loc3_ = textField.scrollV - 1 - verticalScrollPosition;
  880.             horizontalScrollPosition = textField.scrollH;
  881.             verticalScrollPosition = textField.scrollV - 1;
  882.             if(_loc2_)
  883.             {
  884.                _loc4_ = new ScrollEvent(ScrollEvent.SCROLL,false,false,null,horizontalScrollPosition,ScrollEventDirection.HORIZONTAL,_loc2_);
  885.                dispatchEvent(_loc4_);
  886.             }
  887.             if(_loc3_)
  888.             {
  889.                _loc4_ = new ScrollEvent(ScrollEvent.SCROLL,false,false,null,verticalScrollPosition,ScrollEventDirection.VERTICAL,_loc3_);
  890.                dispatchEvent(_loc4_);
  891.             }
  892.          }
  893.       }
  894.       
  895.       public function set wordWrap(param1:Boolean) : void
  896.       {
  897.          if(param1 == _wordWrap)
  898.          {
  899.             return;
  900.          }
  901.          _wordWrap = param1;
  902.          wordWrapChanged = true;
  903.          invalidateProperties();
  904.          invalidateDisplayList();
  905.          dispatchEvent(new Event("wordWrapChanged"));
  906.       }
  907.       
  908.       private function textField_textModifiedHandler(param1:Event) : void
  909.       {
  910.          textFieldChanged(false,true);
  911.       }
  912.       
  913.       private function textField_textFormatChangeHandler(param1:Event) : void
  914.       {
  915.          textFieldChanged(true,false);
  916.       }
  917.       
  918.       public function set htmlText(param1:String) : void
  919.       {
  920.          textSet = true;
  921.          if(!param1)
  922.          {
  923.             param1 = "";
  924.          }
  925.          _htmlText = param1;
  926.          htmlTextChanged = true;
  927.          _text = null;
  928.          explicitHTMLText = param1;
  929.          invalidateProperties();
  930.          invalidateSize();
  931.          invalidateDisplayList();
  932.          dispatchEvent(new Event("htmlTextChanged"));
  933.       }
  934.       
  935.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  936.       {
  937.          super.updateDisplayList(param1,param2);
  938.          var _loc3_:EdgeMetrics = viewMetrics;
  939.          _loc3_.left += getStyle("paddingLeft");
  940.          _loc3_.top += getStyle("paddingTop");
  941.          _loc3_.right += getStyle("paddingRight");
  942.          _loc3_.bottom += getStyle("paddingBottom");
  943.          textField.move(_loc3_.left,_loc3_.top);
  944.          var _loc4_:Number = param1 - _loc3_.left - _loc3_.right;
  945.          var _loc5_:Number = param2 - _loc3_.top - _loc3_.bottom;
  946.          if(_loc3_.top + _loc3_.bottom > 0)
  947.          {
  948.             _loc5_++;
  949.          }
  950.          textField.setActualSize(Math.max(4,_loc4_),Math.max(4,_loc5_));
  951.          if(!initialized)
  952.          {
  953.             callLater(invalidateDisplayList);
  954.          }
  955.          else
  956.          {
  957.             callLater(adjustScrollBars);
  958.          }
  959.          if(isNaN(_hScrollPosition))
  960.          {
  961.             _hScrollPosition = 0;
  962.          }
  963.          if(isNaN(_vScrollPosition))
  964.          {
  965.             _vScrollPosition = 0;
  966.          }
  967.          var _loc6_:Number = Math.min(textField.maxScrollH,_hScrollPosition);
  968.          if(_loc6_ != textField.scrollH)
  969.          {
  970.             horizontalScrollPosition = _loc6_;
  971.          }
  972.          _loc6_ = Math.min(textField.maxScrollV - 1,_vScrollPosition);
  973.          if(_loc6_ != textField.scrollV - 1)
  974.          {
  975.             verticalScrollPosition = _loc6_;
  976.          }
  977.       }
  978.       
  979.       public function getLineMetrics(param1:int) : TextLineMetrics
  980.       {
  981.          return !!textField ? textField.getLineMetrics(param1) : null;
  982.       }
  983.       
  984.       override public function get verticalScrollPolicy() : String
  985.       {
  986.          return height <= 40 ? ScrollPolicy.OFF : mx_internal::_verticalScrollPolicy;
  987.       }
  988.       
  989.       public function get length() : int
  990.       {
  991.          return text != null ? text.length : -1;
  992.       }
  993.    }
  994. }
  995.  
  996.